<template>
	<div class="bbx-timeline-box">
		<div class="bbx-timeline-list-box">
			<div class="bbx-timeline-item-box" v-for="(item, index) in listData.list" :key="index">
				<div class="bbx-timeline-item-diot"></div>
				<components is="whoDidWhat" :item-data="item" :mode="mode">
				</components>
				<slot name="whoDidWhatDes" :record="item"></slot>
				<p class="bbx-timeline-time">{{ getTime(item) }}</p>
			</div>
		</div>
		<div class="bbx-timeline-tip-box">
			
		</div>
	</div>
</template>

<script>
import { defineComponent } from 'vue';
import Page from '@model/Page.ts'
import { formatDate } from 'pub-bbx-utils'
import { t } from '@src/locales'
export default defineComponent({
	name:'base-timeline-V2',
	provide:{
		modeNameEnum:{
			'task':t('common.base.task')
		}
	},
	props:{
		listData:{
			type:Object,
			default:new Page()
		},
		mode:{
			type:String,
			default:''
		},
		loading:{
			type:Boolean,
			default:false
		},
	},
	components:{
	},
	setup(props, {emit}){

		function getTime(item) {
			// 呼叫中心时间取content.ring
			return formatDate(item.module == 'callCenter' ? item.content.ring : item.createTime);
		}
		
		return {
			getTime
		}
	}
})
</script>
<style lang="scss" scoped>
@import './index.scss'
</style>
